{% extends "h:templates/layouts/admin.html.jinja2" %}

{% set page_id = 'features.cohorts' %}
{% set page_title = 'Feature Cohorts' %}

{% block content %}
  <p>
    On this page you can see a list of all the feature cohorts.
  </p>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">Create a feature cohort</h3>
    </div>
    <div class="panel-body">
      <form method="POST" class="form-inline">
        <input type="hidden" name="csrf_token" value="{{ get_csrf_token() }}">
        <div class="form-group">
          <label for="add">Feature cohort name</label>
          <input type="text" class="form-control" name="add">
          <input type="submit" class="btn btn-default" value="Add">
        </div>
      </form>
    </div>
  </div>

  <div class="table-responsive">
    <table class="table table-striped">
      <thead>
        <tr>
          <th>Name</th>
          <th>Members</th>
        </tr>
      </thead>
      <tbody>
        {% for cohort in results %}
          <tr>
            <td>
              <a href="{{ request.route_url('admin.cohorts_edit', id=cohort.id) }}">
                {{ cohort.name }}
              </a>
            </td>
            <td>{{ cohort.members|length }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>

  {% include "h:templates/includes/paginator.html.jinja2" %}
{% endblock %}
